<?php

namespace Home\Controller;
use OT\DataDictionary;

/**
 * 前台管理员控制器
 * 主要获取管理员页聚合数据
 */
class AdministratorController extends HomeController {
    
	//展位管理
	public function administrator_management(){
        $map = array();
        $map  = array('status' => 1);//状态status的值
        if(isset($_GET['name'])){
            $map['name']    =   array('like', '%'.(string)I('name').'%');
        }
		
		$lists = $this->lists('Customer_info',$map,'uid asc');
		//$lists  = D('Customer_info')->where($map)->order('uid asc')->select();//查询语句
    	$this->assign('administratormanagement',$lists);
	 
	    $this->display();
	}

	//信息录入
	 public function admin_land(){
		
		include "Connect.class.php";
		if(isset($_POST['submit'])){
			$nature=$_POST['nature'];
			$sql="insert into onethink_admin (uid,nature) values('','$nature')";
			$return=$pdo->exec($sql);
			if($return==true){
				 $this->success('提交成功！');
			}else{
                $this->error('提交失败!');
            }

		}
		$this->display();
	 
	 }
	 //管理员区域划分
	 public function admin_region(){
	 

	   $this->display();
	 
	 }

	

	//删除操作
	public function del(){
		$id=array_unique((array)I('uid',0));
		if(empty($id)){
			$this->error('请输入数据!');

		}
		$where=array('uid'=>array('in',$id));
		if(M('Customer_info')->where($where)->delete()){
			S('DB_CONFIG_DATA',null);
			//记录行为
			action_log('update_config','Customer_info',$id,UID);
			$this->success('删除成功');
		}else{
			$this->error('删除失败');
		}
	}

}